home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / turbo_part1.lha / modula / m2lib / M2Lib.def < prev    next >
Encoding:
Text File  |  1994-11-12  |  1.8 KB  |  51 lines

  1. DEFINITION FOR C MODULE M2Lib ;
  2.  
  3. FROM SYSTEM IMPORT ADDRESS, STRING ;
  4.  
  5. VAR (* The following variables are READ ONLY!! *)
  6.   wbStarted : BOOLEAN ;
  7.   _WBMsg    : ADDRESS ; (* Startup message sent to us by workbench,         *)
  8.               (* Do not reply to it, as the DICE exit code will    *)
  9.               (* do this at the correct time.                 *)
  10.               (* WBMsg is only valid if wbStarted = TRUE         *)
  11.               (* There is a copy of this variable in WorkBench.def *)
  12.               (* which is properly typed: VAR WBMsg : WBStartupPtr *)
  13.  
  14. (* following are only valid if wbStarted = FALSE (CLI startup) *)
  15.   argc : LONGINT ; (* # of cmd line arguments eg [m2c x.mod] = 2 arguments *)
  16.   argv : POINTER TO ARRAY (* 0..argc-1 *) OF STRING ;
  17.  
  18. PROCEDURE OpenLib( name : STRING ; version : LONGINT ) : ADDRESS ;
  19. (* Like the Exec version but the library is automatically closed at program   *)
  20. (* exit.                                      *)
  21.  
  22. PROCEDURE _ErrorReq( s1,s2 : STRING ) ;
  23. (* Displays an error requester with s1,s2 and then calls StdLib.exit(20)  *)
  24. (* dont pass NIL as either argument pass " " instead.              *)
  25.  
  26. PROCEDURE CheckStack( needBytes : LONGINT ) ;
  27. (* Checks that needBytes of space are avaiable on the stack.         *)
  28. (* calls _ErrorReq if there are not.                     *)
  29. (* Used for manual stack checking. Place calls to this procedure in      *)
  30. (* the recursive call paths of your program.                  *)
  31. (* If the check fails then this functions mallocs a new stack before the *)
  32. (* _ErrorReq call.                             *)
  33. (* DO NOT use if youre program creates coroutines or Exec tasks         *)
  34.  
  35. PROCEDURE CheckStack512 ;
  36. (* Same as CheckStack(512) but faster *)
  37.  
  38. (* Duplicated from StdLib.def *)
  39.  
  40. TYPE
  41.   IntProc = PROCEDURE( ) : LONGINT ;
  42.  
  43. PROCEDURE onbreak( ip : IntProc ) : IntProc ;
  44. PROCEDURE atexit( p : PROC ) ;
  45. PROCEDURE exit( n : LONGINT ) ;
  46.  
  47. PROCEDURE malloc( size : LONGINT ) : ADDRESS ;
  48. PROCEDURE free( a : ADDRESS ) ;
  49.  
  50. END M2Lib.
  51.